package com.smartstores.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.smartstores.R;
import com.smartstores.mundo.Producto;

public class ShoppingListAdapter extends ArrayAdapter<Producto> {

	private Context ctx;
	private int id;

	public ShoppingListAdapter(Context context, int textViewResourceId) {
		super(context, textViewResourceId);
		ctx = context;
		id = textViewResourceId;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView row = null;
		if (convertView == null) {
			LayoutInflater inflater = (LayoutInflater) ctx
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			row = (TextView) inflater.inflate(id, parent, false);
		} else {
			row = (TextView) convertView;
		}

		row.setText(this.getItem(position).toString());
		if (row.getText().toString().contains("Precio Total")) {
			row.setBackgroundColor(Color.rgb(255, 140, 0));
			row.setTextColor(Color.BLACK);
		}

		return row;
	}

}
